Skip to content

Comments

Feature: Don't call GetCost when action is disabled#371

Merged
crashkonijn merged 1 commit intomasterfrom
feature/dont-call-getcost-when-disabled
Dec 9, 2025
Merged

Feature: Don't call GetCost when action is disabled#371
crashkonijn merged 1 commit intomasterfrom
feature/dont-call-getcost-when-disabled

Conversation

@crashkonijn
Copy link
Owner

This pull request refactors the AgentTypeJobRunner class in the Goap runtime package to improve how action costs are calculated based on their enabled state, enhances resource management, and adds new unit tests to verify this behavior. The changes also include minor code style improvements and reordering of field declarations for clarity.

AgentTypeJobRunner logic improvements

  • The cost for actions is now only calculated if the action is enabled; otherwise, the cost is set to zero. This prevents unnecessary computation for disabled actions and ensures correctness.

Unit test additions and improvements

  • Two new tests are added: one verifies that GetCost is called only for enabled actions, and another ensures it is not called for disabled actions. This directly tests the new cost calculation logic.
  • Minor code style and consistency improvements in existing tests, such as using consistent list initializations.

Fixes #363

@crashkonijn crashkonijn merged commit f00159e into master Dec 9, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Disable GetCost() method from running while action is disabled

1 participant